Add IPipelineStep interface and PipelineContext - #280
Merged
Conversation
…sult - IPipelineStep: defines contract for pipeline steps with ShouldExecute and ExecuteAsync - PipelineContext: mutable context carrying DriverInfo, Strategy, Result, and a Bag for inter-step data - PipelineResult: step execution outcome with Ok/Fail factory methods Closes #279
Contributor
There was a problem hiding this comment.
Pull request overview
Adds foundational pipeline abstractions in GeneralUpdate.Drivelution to support the upcoming Drivelution refactor (BaseDriverUpdater pipeline), aiming to reduce duplicated update logic across OS-specific implementations.
Changes:
- Introduces
IPipelineStepas the contract for pipeline steps (ShouldExecute+ExecuteAsync). - Adds
PipelineContextto carryDriverInfo,UpdateStrategy,UpdateResult, plus a shared mutableBag. - Adds
PipelineResultto represent per-step outcomes withOk()/Fail(...)factory methods.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/c#/GeneralUpdate.Drivelution/Core/Pipeline/PipelineResult.cs | Adds a step-level result type with success/failure factories. |
| src/c#/GeneralUpdate.Drivelution/Core/Pipeline/PipelineContext.cs | Adds the mutable context object passed through pipeline steps, including a shared bag. |
| src/c#/GeneralUpdate.Drivelution/Core/Pipeline/IPipelineStep.cs | Adds the pipeline step interface (name, conditional execution, async execution). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+11
to
+38
| public bool Success { get; init; } | ||
|
|
||
| /// <summary> | ||
| /// Error message if the step failed (null when successful). | ||
| /// </summary> | ||
| public string? ErrorMessage { get; init; } | ||
|
|
||
| /// <summary> | ||
| /// Optional exception captured during step execution. | ||
| /// </summary> | ||
| public Exception? Exception { get; init; } | ||
|
|
||
| /// <summary> | ||
| /// Creates a successful result. | ||
| /// </summary> | ||
| public static PipelineResult Ok() => new() { Success = true }; | ||
|
|
||
| /// <summary> | ||
| /// Creates a failed result with an error message. | ||
| /// </summary> | ||
| /// <param name="errorMessage">Description of the failure.</param> | ||
| /// <param name="exception">Optional exception that caused the failure.</param> | ||
| public static PipelineResult Fail(string errorMessage, Exception? exception = null) => new() | ||
| { | ||
| Success = false, | ||
| ErrorMessage = errorMessage, | ||
| Exception = exception | ||
| }; |
Comment on lines
+1
to
+3
| using GeneralUpdate.Drivelution.Abstractions.Models; | ||
|
|
||
| namespace GeneralUpdate.Drivelution.Core.Pipeline; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add the core Pipeline abstractions for the Drivelution refactoring.
Changes
Why
These abstractions form the foundation for the \BaseDriverUpdater\ pipeline base class (coming in sub-task 2), which will eliminate ~60% code duplication between the Windows and Linux implementations.
Closes #279